<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.text.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"   pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>IPL 5 - RED</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="content-language" content="" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%@ include file="global.jsp" %>
<%
String resposeText = "";
String errorMesg = (String) session.getAttribute("error");
out.println("<script>alert(\\"+errorMesg+"\\)</script>");
if (session.getAttribute("resposeText") != null) {

	if(null != (String)session.getAttribute("resposeText")){ 
		out.println("<script>alert("+(String)session.getAttribute("resposeText")+")</script>");
    }else{
    	out.println("<script>alert(\"No Mesg\")</script>");
    }
	
	if(("Succesfully Submited").equals((String)session.getAttribute("resposeText"))){ 
		out.println("<script>alert(\"Succesfully Submited\")</script>");
    }else if(("User Not Registered").equals((String)session.getAttribute("resposeText"))){
    	out.println("<script>alert(\"User Not Registered\")</script>");
    }else if(("Entry already made").equals((String)session.getAttribute("resposeText"))){
    	out.println("<script>alert(\"Entry already made\")</script>");
    }else if(("Please enter your name").equals((String)session.getAttribute("resposeText"))){
    	out.println("<script>alert(\"Please enter your name\")</script>");
    }else if(("Exception Occurred").equals((String)session.getAttribute("resposeText"))){
    	out.println("<script>alert(\"Exception Occurred\")</script>");
    }else if(("Unauthorized User").equals((String)session.getAttribute("resposeText"))){
    	out.println("<script>alert(\"Unauthorized User\")</script>");
    }else if(("UserName Not Entered").equals((String)session.getAttribute("resposeText"))){
    	out.println("<script>alert(\"UserName Not Entered\")</script>");
    }else{
    	out.println("<script>alert(\\"+errorMesg+"\\)</script>");
    }
} 
%>


    <div id="page">
        <div id="header">
            <h1><a href="#">IPL-5  2012</a></h1>
        </div>
        <div id="menu">
            <%@ include file="links.jsp" %>
        </div>
        <!-- div>
			<%
			if(null!=errorMesg){
				%>
				<div style="color:red;">
				<b><%=errorMesg%></b>
				</div>
				<%
			}
			%>
		</div-->
		<div>
			<table width="100%">
				<tr>
					<td align="right">
						Logged User: <%=(String) session.getAttribute("userName") %> &nbsp; <a href="logout.jsp">logout</a>
					</td>
				</tr>
			</table>
			
		</div>
         
        <div id="main">		              
            <div id="content">
            <fieldset>
            <!-- legend>Successfully Registered::<%=(String) session.getAttribute("userName") %></legend-->
            <table border="1" width="100%" cellspacing="0" cellpadding="0">
            <tr>
            	<td  align="center" colspan="5"><b><font face="verdana" size="8" color="green">You Have Successfully Registered, Please note the details below.</font></b></td>
            </tr>
            <tr>
            	<th>User Name</th>
            	<th>Password</th>
            	<th>Name</th>
            	<th>Email</th>
            	<th>League</th>
            </tr>
            <%
            try{
            	String userName = (String) session.getAttribute("userName");
            	Class.forName(db_driver);
        		Connection conn = DriverManager.getConnection(db_url, db_user, db_password);
	    		Statement stmt = conn.createStatement();
	    		String str = "select userName, password, Name, email, league from users where userName = '"+userName+"'";
	    		System.out.println("SQL: "+str);
				ResultSet rset = stmt.executeQuery(str);
	    		while (rset.next()){
	      		%>
		        	<tr>
		        	<td align="center"><%=rset.getString(1)%></td>
		        	<td align="center"><%=rset.getString(2)%></td>
		        	<td align="center"><%=rset.getString(3)%></td>
		        	<td align="center"><%=rset.getString(4)%></td>
		        	<td align="center"><%=rset.getString(5)%></td>
		        	</tr>
		        	</table>
		        	</fieldset>
		        <%
	    		}
	    		stmt.close();
		        conn.close();
			}
	  		catch ( Exception e1){
				e1.printStackTrace();
			} 
			finally{
			}
		    %>
			
            </div><!-- content -->
                       
            <div class="clearing">&nbsp;</div>   
        </div><!-- main -->
    </div><!-- page -->
    <div id="footer">
        <p>Copyright &copy; 2010, designed by <a href="http://www.kiranvenkat.in/">kiranvenkat.in</a></p>
    </div>
</body>
</html>
<%
   if ( session.getAttribute("resposeText") != null && !("").equals(session.getAttribute("resposeText")))
   { 
		session.setAttribute("resposeText", null);
   }
%>